package com.fasc.open.api.client;

import com.fasc.open.api.bean.base.BaseRes;
import com.fasc.open.api.bean.base.BaseResponseEntity;
import com.fasc.open.api.bean.req.signtask.*;
import com.fasc.open.api.bean.res.common.UrlRes;
import com.fasc.open.api.bean.res.signtask.CreateSignTaskRes;
import com.fasc.open.api.bean.res.signtask.SignTaskDetailRes;
import com.fasc.open.api.constants.OpenApiUrlConstants;
import com.fasc.open.api.exception.ApiException;

/**
 * @author Fadada
 * 2021/9/13 17:10:09
 */
public class SignTaskClient {
    private OpenApiClient openApiClient;

    public SignTaskClient(OpenApiClient openApiClient) {
        this.openApiClient = openApiClient;
    }


    public BaseRes<CreateSignTaskRes> create(CreateSignTaskReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_CREATE, CreateSignTaskRes.class);
    }

    public BaseRes<CreateSignTaskRes> createWithTemplate(CreateWithTemplateReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_CREATE_WITH_TEMPLATE, CreateSignTaskRes.class);
    }

    public BaseRes<Void> addDoc(AddDocReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_DOC_ADD, Void.class);
    }

    public BaseRes<Void> deleteDoc(DeleteDocReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_DOC_DELETE, Void.class);
    }

    public BaseRes<Void> addField(AddFieldReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_FIELD_ADD, Void.class);
    }

    public BaseRes<Void> deleteField(DeleteFieldReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_FIELD_DELETE, Void.class);
    }

    public BaseRes<UrlRes> getFieldUrl(GetFieldUrlReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_FIELD_GET_URL, UrlRes.class);
    }

    public BaseRes<Void> fillFieldValues(FillFieldValuesReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_FIELD_FILL_VALUES, Void.class);
    }

    public BaseRes<Void> addAttach(AddAttachReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_ATTACH_ADD, Void.class);
    }

    public BaseRes<Void> deleteAttach(DeleteAttachReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_ATTACH_DELETE, Void.class);
    }

    public BaseRes<Void> addActor(AddActorsReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_ACTOR_ADD, Void.class);
    }

    public BaseRes<Void> deleteActor(DeleteActorReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_ACTOR_DELETE, Void.class);
    }


    public BaseRes<Void> initiate(SignTaskBaseReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_INITIATE, Void.class);
    }

    public BaseRes<Void> cancel(SignTaskBaseReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_CANCEL, Void.class);
    }

    public BaseRes<Void> finalizeDoc(SignTaskBaseReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_DOC_FINALIZE, Void.class);
    }

    public BaseRes<Void> block(BlockReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_BLOCK, Void.class);
    }

    public BaseRes<Void> unblock(UnblockReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_UNBLOCK, Void.class);
    }

    public BaseRes<Void> urge(SignTaskBaseReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_URGE, Void.class);
    }

    public BaseRes<Void> finish(SignTaskBaseReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_FINISH, Void.class);
    }

    public BaseRes<SignTaskDetailRes> getDetail(SignTaskBaseReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_GET_DETAIL, SignTaskDetailRes.class);
    }

    public BaseRes<BaseResponseEntity> downloadFiles(DownloadFilesReq req) throws ApiException {
        return openApiClient.invokeApiDownload(req, OpenApiUrlConstants.SIGN_TASK_DOWNLOAD_FILES);
    }

    public BaseRes<UrlRes> getUrl(GetUrlReq req) throws ApiException {
        return openApiClient.invokeApi(req, OpenApiUrlConstants.SIGN_TASK_GET_URL, UrlRes.class);
    }


}
